/**
 * @file epd_gfx.h
 * @brief Graphics helpers for EPD planes generation.
 */
#ifndef EPD_GFX_H
#define EPD_GFX_H

#include <stdint.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Generate vertical tri-color stripes into BW and RY bitplanes.
 * @param bw Output plane for black (1=black, 0=white), size width*height/8.
 * @param ry Output plane for red/yellow accent (1=accent, 0=no accent), size width*height/8.
 * @param width Panel width in pixels.
 * @param height Panel height in pixels.
 * @return int 0 on success, negative on error.
 */
int epd_gfx_build_vertical_tricolor_stripes(uint8_t *bw, uint8_t *ry, uint16_t width, uint16_t height);

/**
 * @brief Clear planes to white.
 * @param bw BW plane pointer.
 * @param ry RY plane pointer.
 * @param size_bytes Size of each plane in bytes.
 */
void epd_gfx_clear_planes(uint8_t *bw, uint8_t *ry, uint32_t size_bytes);

/**
 * @brief Convert RGB565 framebuffer into BW/RY bitplanes.
 * @param rgb565 RGB565 framebuffer to be converted.
 * @param bw BW plane pointer.
 * @param ry RY plane pointer.
 * @param width Panel width in pixels.
 * @param height Panel height in pixels.
 * @return int 0 on success, negative on error.
 */
int epd_gfx_convert_rgb565_to_planes(const uint16_t *rgb565,
                                     uint8_t *bw,
                                     uint8_t *ry,
                                     uint16_t width,
                                     uint16_t height);

#ifdef __cplusplus
}
#endif

#endif /* EPD_GFX_H */